import {head} from 'lodash';
import {
  Platform,
  Text,
  View,
  SafeAreaView,
  Button,
  Dimensions,
  ScrollView,
  StyleSheet,
} from 'react-native';
import Orientation from 'react-native-orientation';

const DemoTest = () => {
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.top}>
        <Button
          title="全屏"
          onPress={() => {
            Orientation.lockToLandscapeLeft();
          }}
        />
        <Button
          title="退出全屏"
          onPress={() => {
            Orientation.lockToPortrait();
          }}
        />
      </View>
      <ScrollView style={styles.bottom}>
        {Array(1000)
          .fill(0)
          .map((item, inde) => (
            <Text key={inde}>{inde}/</Text>
          ))}
      </ScrollView>
    </SafeAreaView>
  );
};

export default DemoTest;

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'pink',
    width: '100%',
    height: '100%',
    flexDirection: 'column',
  },
  top: {
    height: 100, // 固定高度100
    backgroundColor: '#f0f0f0',
    justifyContent: 'center',
    alignItems: 'center',
  },
  bottom: {
    flex: 1, // 自适应剩余空间
  },
});
